home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / Videotoolbox 96-08-22-c.sit / VideoToolbox / (Demos) / NoiseVBL.c < prev    next >
MacBinary  |  1996-03-04  |  10.5 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: NoiseVBL.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Mon Mar 4 19:10:19 1996, modified Mon Mar 4 19:10:19 1996, creator 'CWIE', type ASCII, 9799 bytes "NoiseVBL.c" , at 0x26c7 756 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0a 4e 6f 69 73 65 56 | 42 4c 2e 63 00 00 00 00 |..NoiseV|BL.c....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 26 47 00 | 00 02 f4 ad 61 36 eb ad |.....&G.|....a6..|
|00000060| 61 36 eb 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |a6......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 50 bb 00 00 |........|....P...|
|00000080| 2f 2a 0d 4e 6f 69 73 65 | 56 42 4c 2e 63 0d 0d 54 |/*.Noise|VBL.c..T|
|00000090| 68 65 72 65 20 61 72 65 | 20 74 77 6f 20 77 61 79 |here are| two way|
|000000a0| 73 20 74 6f 20 73 79 6e | 63 68 72 6f 6e 69 7a 65 |s to syn|chronize|
|000000b0| 20 79 6f 75 72 20 70 72 | 6f 67 72 61 6d 20 74 6f | your pr|ogram to|
|000000c0| 20 61 20 76 69 64 65 6f | 20 64 69 73 70 6c 61 79 | a video| display|
|000000d0| 2e 20 41 70 70 6c 65 0d | 72 65 63 6f 6d 6d 65 6e |. Apple.|recommen|
|000000e0| 64 73 20 75 73 69 6e 67 | 20 74 68 65 20 76 65 72 |ds using| the ver|
|000000f0| 74 69 63 61 6c 20 62 6c | 61 6e 6b 69 6e 67 20 6c |tical bl|anking l|
|00000100| 65 76 65 6c 20 69 6e 74 | 65 72 72 75 70 74 20 28 |evel int|errupt (|
|00000110| 56 42 4c 29 2e 20 54 68 | 61 74 20 61 70 70 72 6f |VBL). Th|at appro|
|00000120| 61 63 68 20 69 73 0d 69 | 6c 6c 75 73 74 72 61 74 |ach is.i|llustrat|
|00000130| 65 64 20 68 65 72 65 2e | 20 54 68 65 20 6f 74 68 |ed here.| The oth|
|00000140| 65 72 20 61 70 70 72 6f | 61 63 68 2c 20 77 68 69 |er appro|ach, whi|
|00000150| 63 68 20 49 20 6e 6f 72 | 6d 61 6c 6c 79 20 70 72 |ch I nor|mally pr|
|00000160| 65 66 65 72 2c 20 69 73 | 20 74 6f 20 75 73 65 20 |efer, is| to use |
|00000170| 61 20 73 69 64 65 0d 65 | 66 66 65 63 74 20 6f 66 |a side.e|ffect of|
|00000180| 20 6c 6f 61 64 69 6e 67 | 20 74 68 65 20 76 69 64 | loading| the vid|
|00000190| 65 6f 20 63 61 72 64 73 | 20 63 6c 75 74 3a 20 6d |eo cards| clut: m|
|000001a0| 6f 73 74 20 76 69 64 65 | 6f 20 64 72 69 76 65 72 |ost vide|o driver|
|000001b0| 73 20 64 6f 6e 27 74 20 | 72 65 74 75 72 6e 20 75 |s don't |return u|
|000001c0| 6e 74 69 6c 0d 74 68 65 | 20 76 65 72 74 69 63 61 |ntil.the| vertica|
|000001d0| 6c 20 62 6c 61 6e 6b 69 | 6e 67 20 69 6e 74 65 72 |l blanki|ng inter|
|000001e0| 76 61 6c 2e 20 54 68 65 | 20 69 6e 74 65 72 72 75 |val. The| interru|
|000001f0| 70 74 20 61 70 70 72 6f | 61 63 68 20 69 73 20 6d |pt appro|ach is m|
|00000200| 6f 72 65 20 6f 72 20 6c | 65 73 73 0d 67 75 61 72 |ore or l|ess.guar|
|00000210| 61 6e 74 65 65 64 20 74 | 6f 20 77 6f 72 6b 20 6f |anteed t|o work o|
|00000220| 6e 20 61 6c 6c 20 76 69 | 64 65 6f 20 63 61 72 64 |n all vi|deo card|
|00000230| 73 2c 20 73 69 6e 63 65 | 20 41 70 70 6c 65 20 6d |s, since| Apple m|
|00000240| 6f 72 65 20 6f 72 20 6c | 65 73 73 20 72 65 71 75 |ore or l|ess requ|
|00000250| 69 72 65 73 20 74 68 61 | 74 20 69 74 0d 62 65 20 |ires tha|t it.be |
|00000260| 73 75 70 70 6f 72 74 65 | 64 20 62 79 20 61 6c 6c |supporte|d by all|
|00000270| 20 76 69 64 65 6f 20 64 | 72 69 76 65 72 73 2e 20 | video d|rivers. |
|00000280| 49 74 73 20 6f 6e 6c 79 | 20 64 69 73 61 64 76 61 |Its only| disadva|
|00000290| 6e 74 61 67 65 20 69 73 | 20 74 68 61 74 20 0d 69 |ntage is| that .i|
|000002a0| 6e 74 65 72 72 75 70 74 | 73 20 6d 75 73 74 20 62 |nterrupt|s must b|
|000002b0| 65 20 65 6e 61 62 6c 65 | 64 2e 20 49 20 68 61 76 |e enable|d. I hav|
|000002c0| 65 20 74 68 65 20 69 6d | 70 72 65 73 73 69 6f 6e |e the im|pression|
|000002d0| 2d 2d 74 68 6f 75 67 68 | 20 49 20 68 61 76 65 6e |--though| I haven|
|000002e0| 27 74 20 63 6f 6c 6c 65 | 63 74 65 64 0d 68 61 72 |'t colle|cted.har|
|000002f0| 64 20 64 61 74 61 2d 2d | 74 68 61 74 20 69 6e 74 |d data--|that int|
|00000300| 65 72 72 75 70 74 73 20 | 73 74 65 61 6c 20 61 20 |errupts |steal a |
|00000310| 6c 6f 74 20 6f 66 20 74 | 69 6d 65 2c 20 64 65 70 |lot of t|ime, dep|
|00000320| 65 6e 64 69 6e 67 20 6f | 6e 20 68 6f 77 20 62 75 |ending o|n how bu|
|00000330| 73 79 20 41 70 70 6c 65 | 54 61 6c 6b 2c 0d 74 68 |sy Apple|Talk,.th|
|00000340| 65 20 64 69 73 6b 2c 20 | 53 43 53 49 2c 20 6b 65 |e disk, |SCSI, ke|
|00000350| 79 62 6f 61 72 64 2c 20 | 6d 6f 75 73 65 2c 20 61 |yboard, |mouse, a|
|00000360| 6e 64 20 65 76 65 6e 20 | 6d 69 73 63 65 6c 6c 61 |nd even |miscella|
|00000370| 6e 65 6f 75 73 20 49 4e | 49 54 73 20 74 68 61 74 |neous IN|ITs that|
|00000380| 20 61 72 65 20 64 72 69 | 76 65 6e 20 62 79 0d 56 | are dri|ven by.V|
|00000390| 42 4c 20 69 6e 74 65 72 | 72 75 70 74 73 2e 20 53 |BL inter|rupts. S|
|000003a0| 6f 20 77 68 65 6e 20 49 | 20 72 65 61 6c 6c 79 20 |o when I| really |
|000003b0| 77 61 6e 74 20 74 6f 20 | 63 72 61 6e 6b 2c 20 74 |want to |crank, t|
|000003c0| 6f 20 64 69 73 70 6c 61 | 79 20 6d 6f 76 69 65 73 |o displa|y movies|
|000003d0| 2c 20 49 20 70 72 65 66 | 65 72 20 74 6f 0d 75 73 |, I pref|er to.us|
|000003e0| 65 20 53 65 74 50 72 69 | 6f 72 69 74 79 28 37 29 |e SetPri|ority(7)|
|000003f0| 20 74 6f 20 74 65 6d 70 | 6f 72 61 72 69 6c 79 20 | to temp|orarily |
|00000400| 73 75 73 70 65 6e 64 20 | 61 6c 6c 20 69 6e 74 65 |suspend |all inte|
|00000410| 72 72 75 70 74 73 2e 20 | 49 6e 20 74 68 61 74 20 |rrupts. |In that |
|00000420| 63 61 73 65 20 74 68 65 | 0d 76 69 64 65 6f 2d 64 |case the|.video-d|
|00000430| 72 69 76 65 72 20 73 69 | 64 65 20 65 66 66 65 63 |river si|de effec|
|00000440| 74 20 61 70 70 72 6f 61 | 63 68 20 69 73 20 79 6f |t approa|ch is yo|
|00000450| 75 72 20 6f 6e 6c 79 20 | 63 68 6f 69 63 65 2e 20 |ur only |choice. |
|00000460| 48 6f 77 65 76 65 72 2c | 20 62 65 20 77 61 72 6e |However,| be warn|
|00000470| 65 64 20 74 68 61 74 0d | 73 6f 6d 65 20 76 69 64 |ed that.|some vid|
|00000480| 65 6f 20 64 72 69 76 65 | 72 73 20 64 6f 6e 27 74 |eo drive|rs don't|
|00000490| 20 77 61 69 74 2c 20 61 | 6e 64 20 6f 74 68 65 72 | wait, a|nd other|
|000004a0| 73 20 74 61 6b 65 20 6d | 6f 72 65 20 74 68 61 6e |s take m|ore than|
|000004b0| 20 61 20 66 72 61 6d 65 | 20 74 6f 20 6c 6f 61 64 | a frame| to load|
|000004c0| 20 74 68 65 0d 63 6c 75 | 74 2c 20 73 6f 20 64 6f | the.clu|t, so do|
|000004d0| 20 73 6f 6d 65 20 63 61 | 72 65 66 75 6c 20 74 69 | some ca|reful ti|
|000004e0| 6d 69 6e 67 20 62 65 66 | 6f 72 65 20 79 6f 75 20 |ming bef|ore you |
|000004f0| 72 65 6c 79 20 6f 6e 20 | 69 74 2c 20 69 2e 65 2e |rely on |it, i.e.|
|00000500| 20 72 75 6e 20 54 69 6d | 65 56 69 64 65 6f 2e 0d | run Tim|eVideo..|
|00000510| 0d 54 68 69 73 20 70 72 | 6f 67 72 61 6d 20 73 68 |.This pr|ogram sh|
|00000520| 6f 77 73 20 61 20 6e 6f | 69 73 65 20 6d 6f 76 69 |ows a no|ise movi|
|00000530| 65 2c 20 61 20 64 79 6e | 61 6d 69 63 20 72 61 6e |e, a dyn|amic ran|
|00000540| 64 6f 6d 20 63 68 65 63 | 6b 65 72 62 6f 61 72 64 |dom chec|kerboard|
|00000550| 2c 20 61 74 20 36 36 2e | 37 20 48 7a 21 20 0d 45 |, at 66.|7 Hz! .E|
|00000560| 61 63 68 20 66 72 61 6d | 65 20 69 73 20 64 69 73 |ach fram|e is dis|
|00000570| 70 6c 61 79 65 64 20 62 | 79 20 63 61 6c 6c 69 6e |played b|y callin|
|00000580| 67 20 43 6f 70 79 57 69 | 6e 64 6f 77 73 2e 63 2e |g CopyWi|ndows.c.|
|00000590| 20 41 66 74 65 72 20 73 | 68 6f 77 69 6e 67 20 65 | After s|howing e|
|000005a0| 61 63 68 20 66 72 61 6d | 65 20 6f 6e 63 65 0d 4e |ach fram|e once.N|
|000005b0| 6f 69 73 65 56 42 4c 20 | 63 79 63 6c 65 73 20 74 |oiseVBL |cycles t|
|000005c0| 68 72 6f 75 67 68 20 74 | 68 65 6d 20 61 67 61 69 |hrough t|hem agai|
|000005d0| 6e 2e 20 54 68 75 73 20 | 74 6f 20 67 65 74 20 61 |n. Thus |to get a|
|000005e0| 20 74 72 75 65 20 69 6d | 70 72 65 73 73 69 6f 6e | true im|pression|
|000005f0| 20 6f 66 20 77 68 69 74 | 65 20 6e 6f 69 73 65 20 | of whit|e noise |
|00000600| 79 6f 75 0d 6e 65 65 64 | 20 74 6f 20 63 6f 6d 70 |you.need| to comp|
|00000610| 75 74 65 20 6c 6f 74 73 | 20 6f 66 20 6e 6f 69 73 |ute lots| of nois|
|00000620| 65 20 66 72 61 6d 65 73 | 2c 20 65 2e 67 2e 20 31 |e frames|, e.g. 1|
|00000630| 30 30 2e 20 54 68 69 73 | 20 6d 61 79 20 72 65 71 |00. This| may req|
|00000640| 75 69 72 65 20 73 65 76 | 65 72 61 6c 0d 6d 65 67 |uire sev|eral.meg|
|00000650| 61 62 79 74 65 73 2c 20 | 64 65 70 65 6e 64 69 6e |abytes, |dependin|
|00000660| 67 20 77 68 61 74 20 79 | 6f 75 72 20 73 63 72 65 |g what y|our scre|
|00000670| 65 6e 27 73 20 70 69 78 | 65 6c 20 64 65 70 74 68 |en's pix|el depth|
|00000680| 20 69 73 20 73 65 74 20 | 74 6f 2e 0d 0d 48 49 53 | is set |to...HIS|
|00000690| 54 4f 52 59 3a 0d 31 31 | 2f 32 33 2f 38 38 20 44 |TORY:.11|/23/88 D|
|000006a0| 65 6e 69 73 20 50 65 6c | 6c 69 20 77 72 6f 74 65 |enis Pel|li wrote|
|000006b0| 20 69 74 2e 0d 0d 34 2f | 32 30 2f 39 31 20 49 20 | it...4/|20/91 I |
|000006c0| 75 70 64 61 74 65 64 20 | 74 68 69 73 2e 20 49 74 |updated |this. It|
|000006d0| 20 6e 6f 77 20 68 61 73 | 20 65 73 73 65 6e 74 69 | now has| essenti|
|000006e0| 61 6c 6c 79 20 6e 6f 20 | 68 61 72 64 77 61 72 65 |ally no |hardware|
|000006f0| 20 64 65 70 65 6e 64 65 | 6e 63 69 65 73 2e 20 49 | depende|ncies. I|
|00000700| 74 20 64 6f 65 73 0d 72 | 65 71 75 69 72 65 20 74 |t does.r|equire t|
|00000710| 68 61 74 20 74 68 65 20 | 76 69 64 65 6f 20 62 65 |hat the |video be|
|00000720| 20 69 6e 20 61 20 73 6c | 6f 74 2c 20 73 69 6e 63 | in a sl|ot, sinc|
|00000730| 65 20 69 74 20 75 73 65 | 73 20 73 6c 6f 74 20 69 |e it use|s slot i|
|00000740| 6e 74 65 72 72 75 70 74 | 73 2e 20 41 20 62 61 73 |nterrupt|s. A bas|
|00000750| 69 63 0d 70 72 6f 62 6c | 65 6d 20 77 69 74 68 20 |ic.probl|em with |
|00000760| 74 68 65 20 73 63 68 65 | 6d 65 20 69 73 20 74 68 |the sche|me is th|
|00000770| 61 74 20 69 6e 74 65 72 | 72 75 70 74 73 20 73 65 |at inter|rupts se|
|00000780| 65 6d 20 74 6f 20 62 65 | 20 73 68 75 74 20 6f 75 |em to be| shut ou|
|00000790| 74 20 77 68 69 6c 65 20 | 74 68 65 0d 69 6e 74 65 |t while |the.inte|
|000007a0| 72 72 75 70 74 20 73 65 | 72 76 69 63 65 20 72 6f |rrupt se|rvice ro|
|000007b0| 75 74 69 6e 65 73 20 61 | 72 65 20 72 75 6e 6e 69 |utines a|re runni|
|000007c0| 6e 67 2e 20 41 73 20 61 | 20 72 65 73 75 6c 74 20 |ng. As a| result |
|000007d0| 74 68 65 20 74 69 6d 69 | 6e 67 20 69 6e 66 6f 72 |the timi|ng infor|
|000007e0| 6d 61 74 69 6f 6e 20 69 | 73 0d 69 6e 61 63 63 75 |mation i|s.inaccu|
|000007f0| 72 61 74 65 20 73 69 6e | 63 65 20 6d 61 6e 79 20 |rate sin|ce many |
|00000800| 31 20 6d 73 20 69 6e 74 | 65 72 72 75 70 74 73 20 |1 ms int|errupts |
|00000810| 61 72 65 20 6c 6f 73 74 | 20 64 75 72 69 6e 67 20 |are lost| during |
|00000820| 74 68 65 20 63 61 6c 6c | 20 74 6f 0d 43 6f 70 79 |the call| to.Copy|
|00000830| 42 69 74 73 51 75 69 63 | 6b 6c 79 28 29 2e 20 49 |BitsQuic|kly(). I|
|00000840| 20 74 68 69 6e 6b 20 74 | 68 65 20 6f 6e 6c 79 20 | think t|he only |
|00000850| 73 6f 6c 75 74 69 6f 6e | 20 74 6f 20 74 68 69 73 |solution| to this|
|00000860| 20 77 6f 75 6c 64 20 62 | 65 20 74 6f 20 70 75 74 | would b|e to put|
|00000870| 20 74 68 65 20 74 69 6d | 65 0d 63 6f 6e 73 75 6d | the tim|e.consum|
|00000880| 69 6e 67 20 63 61 6c 6c | 20 74 6f 20 43 6f 70 79 |ing call| to Copy|
|00000890| 42 69 74 73 51 75 69 63 | 6b 6c 79 20 62 61 63 6b |BitsQuic|kly back|
|000008a0| 20 69 6e 20 74 68 65 20 | 6d 61 69 6e 20 70 72 6f | in the |main pro|
|000008b0| 67 72 61 6d 2c 20 77 61 | 69 74 69 6e 67 20 66 6f |gram, wa|iting fo|
|000008c0| 72 20 74 68 65 0d 69 6e | 74 65 72 72 75 70 74 20 |r the.in|terrupt |
|000008d0| 73 65 72 76 69 63 65 20 | 72 6f 75 74 69 6e 65 20 |service |routine |
|000008e0| 74 6f 20 67 69 76 65 20 | 69 74 20 70 65 72 6d 69 |to give |it permi|
|000008f0| 73 73 69 6f 6e 20 74 6f | 20 73 74 61 72 74 20 65 |ssion to| start e|
|00000900| 61 63 68 20 6e 65 77 20 | 66 72 61 6d 65 2e 0d 0d |ach new |frame...|
|00000910| 34 2f 31 35 2f 39 32 20 | 52 65 6d 6f 76 65 64 20 |4/15/92 |Removed |
|00000920| 61 6c 6c 20 62 75 67 73 | 20 61 6e 64 20 75 70 64 |all bugs| and upd|
|00000930| 61 74 65 64 20 74 6f 20 | 77 6f 72 6b 20 77 69 74 |ated to |work wit|
|00000940| 68 20 54 48 49 4e 4b 20 | 43 20 35 2e 20 4e 6f 77 |h THINK |C 5. Now|
|00000950| 20 70 72 6f 70 65 72 6c | 79 20 73 65 74 20 41 35 | properl|y set A5|
|00000960| 0d 69 6e 20 74 68 65 20 | 69 6e 74 65 72 72 75 70 |.in the |interrup|
|00000970| 74 20 73 65 72 76 69 63 | 65 20 72 6f 75 74 69 6e |t servic|e routin|
|00000980| 65 73 2c 20 75 73 69 6e | 67 20 74 68 65 20 6d 65 |es, usin|g the me|
|00000990| 74 68 6f 64 20 73 75 67 | 67 65 73 74 65 64 20 69 |thod sug|gested i|
|000009a0| 6e 20 54 65 63 68 20 4e | 6f 74 65 20 31 38 30 2e |n Tech N|ote 180.|
|000009b0| 0d 49 20 72 65 6d 6f 76 | 65 64 20 74 68 65 20 6f |.I remov|ed the o|
|000009c0| 6c 64 20 61 74 74 65 6d | 70 74 20 74 6f 20 64 69 |ld attem|pt to di|
|000009d0| 73 61 62 6c 65 20 41 70 | 70 6c 65 54 61 6c 6b 2c |sable Ap|pleTalk,|
|000009e0| 20 77 68 69 63 68 20 6e | 6f 77 20 73 65 65 6d 73 | which n|ow seems|
|000009f0| 20 74 6f 20 68 61 6e 67 | 20 75 70 20 77 68 65 6e | to hang| up when|
|00000a00| 0d 69 74 20 61 74 74 65 | 6d 70 74 73 20 74 6f 20 |.it atte|mpts to |
|00000a10| 72 65 65 6e 61 62 6c 65 | 20 41 70 70 6c 65 54 61 |reenable| AppleTa|
|00000a20| 6c 6b 2e 20 49 20 61 6c | 73 6f 20 72 65 6d 6f 76 |lk. I al|so remov|
|00000a30| 65 64 20 74 68 65 20 63 | 6c 75 74 20 6d 61 6e 69 |ed the c|lut mani|
|00000a40| 70 75 6c 61 74 69 6f 6e | 73 2e 0d 0d 34 2f 31 36 |pulation|s...4/16|
|00000a50| 2f 39 32 09 50 75 74 20 | 74 68 65 20 6e 6f 69 73 |/92.Put |the nois|
|00000a60| 65 20 69 6e 20 69 74 73 | 20 6f 77 6e 20 77 69 6e |e in its| own win|
|00000a70| 64 6f 77 2e 20 52 75 6e | 20 65 73 73 65 6e 74 69 |dow. Run| essenti|
|00000a80| 61 6c 6c 79 20 63 6f 6e | 74 69 6e 75 6f 75 73 6c |ally con|tinuousl|
|00000a90| 79 20 75 6e 74 69 6c 0d | 75 73 65 72 20 71 75 69 |y until.|user qui|
|00000aa0| 74 73 2e 0d 0d 38 2f 31 | 39 2f 39 32 20 52 65 70 |ts...8/1|9/92 Rep|
|00000ab0| 6c 61 63 65 64 20 6f 62 | 73 6f 6c 65 74 65 20 54 |laced ob|solete T|
|00000ac0| 69 6d 65 49 74 2e 63 20 | 62 79 20 6e 65 77 20 54 |imeIt.c |by new T|
|00000ad0| 69 6d 65 72 2e 63 2e 20 | 54 69 6d 69 6e 67 20 73 |imer.c. |Timing s|
|00000ae0| 65 65 6d 73 20 74 6f 20 | 62 65 20 66 69 6e 65 20 |eems to |be fine |
|00000af0| 6e 6f 77 2e 0d 0d 38 2f | 32 32 2f 39 32 20 64 67 |now...8/|22/92 dg|
|00000b00| 70 20 4d 6f 76 65 64 20 | 6d 6f 73 74 20 6f 66 20 |p Moved |most of |
|00000b10| 74 68 65 20 69 6e 74 65 | 72 72 75 70 74 20 73 65 |the inte|rrupt se|
|00000b20| 72 76 69 63 65 20 72 6f | 75 74 69 6e 65 20 63 6f |rvice ro|utine co|
|00000b30| 64 65 20 74 6f 20 0d 56 | 42 4c 49 6e 74 65 72 72 |de to .V|BLInterr|
|00000b40| 75 70 74 53 65 72 76 69 | 63 65 52 6f 75 74 69 6e |uptServi|ceRoutin|
|00000b50| 65 2e 63 2e 20 4a 75 73 | 74 20 66 6f 72 20 66 75 |e.c. Jus|t for fu|
|00000b60| 6e 2c 20 49 20 6d 61 64 | 65 20 74 68 65 20 70 72 |n, I mad|e the pr|
|00000b70| 6f 67 72 61 6d 20 75 73 | 65 20 61 6e 20 61 6c 74 |ogram us|e an alt|
|00000b80| 65 72 6e 61 74 65 20 6d | 6f 6e 69 74 6f 72 2c 0d |ernate m|onitor,.|
|00000b90| 69 66 20 61 76 61 69 6c | 61 62 6c 65 2e 20 46 69 |if avail|able. Fi|
|00000ba0| 78 65 64 20 61 20 73 6d | 61 6c 6c 20 62 75 67 20 |xed a sm|all bug |
|00000bb0| 74 68 61 74 20 70 72 65 | 76 65 6e 74 65 64 20 64 |that pre|vented d|
|00000bc0| 69 73 70 6c 61 79 20 6f | 66 20 6e 6f 69 73 65 20 |isplay o|f noise |
|00000bd0| 6f 6e 20 61 6e 20 61 6c | 74 65 72 6e 61 74 65 0d |on an al|ternate.|
|00000be0| 6d 6f 6e 69 74 6f 72 20 | 69 66 20 69 74 20 68 61 |monitor |if it ha|
|00000bf0| 64 20 61 20 64 69 66 66 | 65 72 65 6e 74 20 70 69 |d a diff|erent pi|
|00000c00| 78 65 6c 53 69 7a 65 20 | 74 68 61 6e 20 74 68 65 |xelSize |than the|
|00000c10| 20 6d 61 69 6e 20 73 63 | 72 65 65 6e 2e 0d 0d 39 | main sc|reen...9|
|00000c20| 2f 31 35 2f 39 32 20 64 | 67 70 20 55 70 64 61 74 |/15/92 d|gp Updat|
|00000c30| 65 64 20 74 6f 20 75 73 | 65 20 6e 65 77 20 54 69 |ed to us|e new Ti|
|00000c40| 6d 65 72 2e 63 2e 0d 0d | 32 2f 31 38 2f 39 33 09 |mer.c...|2/18/93.|
|00000c50| 64 67 70 09 41 64 64 65 | 64 20 66 70 75 20 74 65 |dgp.Adde|d fpu te|
|00000c60| 73 74 2e 0d 32 2f 32 30 | 2f 39 33 09 64 67 70 09 |st..2/20|/93.dgp.|
|00000c70| 43 61 6c 6c 20 52 65 71 | 75 69 72 65 28 29 2c 20 |Call Req|uire(), |
|00000c80| 69 6e 63 72 65 61 73 65 | 64 20 73 74 61 63 6b 20 |increase|d stack |
|00000c90| 73 70 61 63 65 2e 0d 37 | 2f 37 2f 39 33 09 64 67 |space..7|/7/93.dg|
|00000ca0| 70 20 72 65 70 6c 61 63 | 65 64 20 63 61 6c 6c 20 |p replac|ed call |
|00000cb0| 74 6f 20 43 6f 70 79 42 | 69 74 73 51 75 69 63 6b |to CopyB|itsQuick|
|00000cc0| 6c 79 20 62 79 20 43 6f | 70 79 42 69 74 73 2c 20 |ly by Co|pyBits, |
|00000cd0| 66 6f 72 20 63 6f 6d 70 | 61 74 69 62 69 6c 69 74 |for comp|atibilit|
|00000ce0| 79 20 77 69 74 68 0d 52 | 61 64 69 75 73 20 50 6f |y with.R|adius Po|
|00000cf0| 77 65 72 56 69 65 77 2e | 0d 33 2f 31 39 2f 39 34 |werView.|.3/19/94|
|00000d00| 09 64 67 70 20 75 70 64 | 61 74 65 64 20 74 68 65 |.dgp upd|ated the|
|00000d10| 20 63 61 6c 6c 20 74 6f | 20 53 68 75 66 66 6c 65 | call to| Shuffle|
|00000d20| 28 29 2c 20 61 64 64 69 | 6e 67 20 6e 65 77 20 72 |(), addi|ng new r|
|00000d30| 65 71 75 69 72 65 64 20 | 61 72 67 75 6d 65 6e 74 |equired |argument|
|00000d40| 2e 0d 35 2f 33 30 2f 39 | 34 09 64 67 70 09 63 61 |..5/30/9|4.dgp.ca|
|00000d50| 6c 6c 20 53 74 61 63 6b | 47 72 6f 77 28 29 20 62 |ll Stack|Grow() b|
|00000d60| 65 66 6f 72 65 20 63 61 | 6c 6c 69 6e 67 20 4e 6f |efore ca|lling No|
|00000d70| 69 73 65 56 42 4c 28 29 | 2e 0d 37 2f 32 37 2f 39 |iseVBL()|..7/27/9|
|00000d80| 34 20 64 67 70 20 63 68 | 61 6e 67 65 64 20 22 74 |4 dgp ch|anged "t|
|00000d90| 68 65 50 6f 72 74 22 20 | 74 6f 20 26 71 64 2e 74 |hePort" |to &qd.t|
|00000da0| 68 65 50 6f 72 74 2c 20 | 66 6f 72 20 62 72 6f 61 |hePort, |for broa|
|00000db0| 64 65 72 20 63 6f 6d 70 | 61 74 69 62 69 6c 69 74 |der comp|atibilit|
|00000dc0| 79 2c 20 61 73 20 73 75 | 67 67 65 73 74 65 64 20 |y, as su|ggested |
|00000dd0| 62 79 0d 4d 61 72 74 79 | 20 57 61 63 68 74 65 72 |by.Marty| Wachter|
|00000de0| 2e 0d 39 2f 35 2f 39 34 | 20 64 67 70 20 72 65 6d |..9/5/94| dgp rem|
|00000df0| 6f 76 65 64 20 61 73 73 | 75 6d 70 74 69 6f 6e 20 |oved ass|umption |
|00000e00| 69 6e 20 70 72 69 6e 74 | 66 27 73 20 74 68 61 74 |in print|f's that|
|00000e10| 20 69 6e 74 3d 3d 73 68 | 6f 72 74 2e 0d 31 31 2f | int==sh|ort..11/|
|00000e20| 36 2f 39 34 20 64 67 70 | 20 75 70 64 61 74 65 64 |6/94 dgp| updated|
|00000e30| 20 74 6f 20 64 65 6d 6f | 6e 73 74 72 61 74 65 20 | to demo|nstrate |
|00000e40| 75 73 65 20 6f 66 20 47 | 57 6f 72 6c 64 20 61 6e |use of G|World an|
|00000e50| 64 20 43 6f 70 79 57 69 | 6e 64 6f 77 73 28 29 2e |d CopyWi|ndows().|
|00000e60| 0d 36 2f 31 34 2f 39 35 | 20 64 67 70 20 75 70 64 |.6/14/95| dgp upd|
|00000e70| 61 74 65 64 20 74 6f 20 | 75 73 65 20 4d 69 63 72 |ated to |use Micr|
|00000e80| 6f 73 65 63 6f 6e 64 73 | 28 29 20 69 6e 73 74 65 |oseconds|() inste|
|00000e90| 61 64 20 6f 66 20 54 69 | 6d 65 72 2e 63 2e 20 47 |ad of Ti|mer.c. G|
|00000ea0| 65 74 4e 65 78 74 45 76 | 65 6e 74 28 29 20 68 61 |etNextEv|ent() ha|
|00000eb0| 64 20 74 68 65 20 77 72 | 6f 6e 67 0d 09 65 76 65 |d the wr|ong..eve|
|00000ec0| 6e 74 4d 61 73 6b 3a 20 | 22 6b 65 79 44 6f 77 6e |ntMask: |"keyDown|
|00000ed0| 22 20 69 6e 73 74 65 61 | 64 20 6f 66 20 22 6b 65 |" instea|d of "ke|
|00000ee0| 79 44 6f 77 6e 4d 61 73 | 6b 22 2e 20 0d 31 31 2f |yDownMas|k". .11/|
|00000ef0| 31 30 2f 39 35 20 64 67 | 70 20 49 6d 70 72 6f 76 |10/95 dg|p Improv|
|00000f00| 65 64 20 74 68 65 20 74 | 65 73 74 20 66 6f 72 20 |ed the t|est for |
|00000f10| 61 76 61 69 6c 61 62 69 | 6c 69 74 79 20 6f 66 20 |availabi|lity of |
|00000f20| 74 68 65 20 4d 69 63 72 | 6f 73 65 63 6f 6e 64 73 |the Micr|oseconds|
|00000f30| 20 74 72 61 70 2c 20 61 | 73 20 73 75 67 67 65 73 | trap, a|s sugges|
|00000f40| 74 65 64 20 62 79 0d 09 | 09 41 70 70 6c 65 27 73 |ted by..|.Apple's|
|00000f50| 20 4d 61 63 20 54 65 63 | 68 20 51 26 41 2e 0d 2a | Mac Tec|h Q&A..*|
|00000f60| 2f 0d 23 69 6e 63 6c 75 | 64 65 20 22 56 69 64 65 |/.#inclu|de "Vide|
|00000f70| 6f 54 6f 6f 6c 62 6f 78 | 2e 68 22 0d 23 69 66 20 |oToolbox|.h".#if |
|00000f80| 55 4e 49 56 45 52 53 41 | 4c 5f 48 45 41 44 45 52 |UNIVERSA|L_HEADER|
|00000f90| 53 0d 09 23 69 6e 63 6c | 75 64 65 20 3c 4c 6f 77 |S..#incl|ude <Low|
|00000fa0| 4d 65 6d 2e 68 3e 0d 23 | 65 6c 73 65 0d 09 23 64 |Mem.h>.#|else..#d|
|00000fb0| 65 66 69 6e 65 20 4c 4d | 47 65 74 4d 42 61 72 48 |efine LM|GetMBarH|
|00000fc0| 65 69 67 68 74 28 29 20 | 28 2a 20 28 73 68 6f 72 |eight() |(* (shor|
|00000fd0| 74 20 2a 29 20 30 78 30 | 42 41 41 29 0d 09 23 64 |t *) 0x0|BAA)..#d|
|00000fe0| 65 66 69 6e 65 20 4c 4d | 53 65 74 4d 42 61 72 48 |efine LM|SetMBarH|
|00000ff0| 65 69 67 68 74 28 4d 42 | 61 72 48 65 69 67 68 74 |eight(MB|arHeight|
|00001000| 56 61 6c 75 65 29 20 28 | 28 2a 20 28 73 68 6f 72 |Value) (|(* (shor|
|00001010| 74 20 2a 29 20 30 78 30 | 42 41 41 29 20 3d 20 28 |t *) 0x0|BAA) = (|
|00001020| 4d 42 61 72 48 65 69 67 | 68 74 56 61 6c 75 65 29 |MBarHeig|htValue)|
|00001030| 29 0d 09 74 79 70 65 64 | 65 66 20 75 6e 73 69 67 |)..typed|ef unsig|
|00001040| 6e 65 64 20 6c 6f 6e 67 | 20 55 49 6e 74 33 32 3b |ned long| UInt32;|
|00001050| 0d 09 73 74 72 75 63 74 | 20 55 6e 73 69 67 6e 65 |..struct| Unsigne|
|00001060| 64 57 69 64 65 20 7b 0d | 09 09 55 49 6e 74 33 32 |dWide {.|..UInt32|
|00001070| 20 68 69 3b 0d 09 09 55 | 49 6e 74 33 32 20 6c 6f | hi;...U|Int32 lo|
|00001080| 3b 0d 09 7d 3b 0d 09 74 | 79 70 65 64 65 66 20 73 |;..};..t|ypedef s|
|00001090| 74 72 75 63 74 20 55 6e | 73 69 67 6e 65 64 57 69 |truct Un|signedWi|
|000010a0| 64 65 20 55 6e 73 69 67 | 6e 65 64 57 69 64 65 2c |de Unsig|nedWide,|
|000010b0| 20 2a 55 6e 73 69 67 6e | 65 64 57 69 64 65 50 74 | *Unsign|edWidePt|
|000010c0| 72 3b 0d 09 65 78 74 65 | 72 6e 20 70 61 73 63 61 |r;..exte|rn pasca|
|000010d0| 6c 20 76 6f 69 64 20 4d | 69 63 72 6f 73 65 63 6f |l void M|icroseco|
|000010e0| 6e 64 73 28 55 6e 73 69 | 67 6e 65 64 57 69 64 65 |nds(Unsi|gnedWide|
|000010f0| 20 2a 6d 69 63 72 6f 54 | 69 63 6b 43 6f 75 6e 74 | *microT|ickCount|
|00001100| 29 3d 7b 30 78 41 31 39 | 33 2c 20 30 78 32 32 35 |)={0xA19|3, 0x225|
|00001110| 46 2c 20 30 78 32 32 43 | 38 2c 20 30 78 32 32 38 |F, 0x22C|8, 0x228|
|00001120| 30 7d 3b 0d 23 65 6e 64 | 69 66 0d 0d 2f 2a 20 54 |0};.#end|if../* T|
|00001130| 68 65 20 75 73 65 72 20 | 6d 61 79 20 77 69 73 68 |he user |may wish|
|00001140| 20 74 6f 20 61 64 6a 75 | 73 74 20 74 68 65 73 65 | to adju|st these|
|00001150| 2e 20 57 49 44 54 48 20 | 73 68 6f 75 6c 64 20 62 |. WIDTH |should b|
|00001160| 65 20 61 20 6d 75 6c 74 | 69 70 6c 65 20 6f 66 20 |e a mult|iple of |
|00001170| 34 2e 20 2a 2f 0d 23 64 | 65 66 69 6e 65 20 4d 41 |4. */.#d|efine MA|
|00001180| 58 46 52 41 4d 45 53 09 | 32 30 30 09 09 2f 2f 20 |XFRAMES.|200..// |
|00001190| 6e 75 6d 62 65 72 20 6f | 66 20 66 72 61 6d 65 73 |number o|f frames|
|000011a0| 20 69 6e 20 6d 6f 76 69 | 65 0d 23 64 65 66 69 6e | in movi|e.#defin|
|000011b0| 65 20 57 49 44 54 48 09 | 32 35 36 09 09 09 2f 2a |e WIDTH.|256.../*|
|000011c0| 20 77 69 64 74 68 20 6f | 66 20 64 69 73 70 6c 61 | width o|f displa|
|000011d0| 79 65 64 20 6e 6f 69 73 | 65 20 6d 6f 76 69 65 2c |yed nois|e movie,|
|000011e0| 20 69 6e 20 70 69 78 65 | 6c 73 20 2a 2f 0d 23 64 | in pixe|ls */.#d|
|000011f0| 65 66 69 6e 65 20 48 45 | 49 47 48 54 09 32 35 36 |efine HE|IGHT.256|
|00001200| 09 09 09 2f 2a 20 68 65 | 69 67 68 74 20 6f 66 20 |.../* he|ight of |
|00001210| 64 69 73 70 6c 61 79 65 | 64 20 6e 6f 69 73 65 20 |displaye|d noise |
|00001220| 6d 6f 76 69 65 2c 20 69 | 6e 20 70 69 78 65 6c 73 |movie, i|n pixels|
|00001230| 20 2a 2f 0d 23 64 65 66 | 69 6e 65 20 52 41 4e 44 | */.#def|ine RAND|
|00001240| 4f 4d 50 48 41 53 45 20 | 31 09 09 2f 2a 20 72 61 |OMPHASE |1../* ra|
|00001250| 6e 64 6f 6d 6c 79 20 73 | 68 69 66 74 20 65 61 63 |ndomly s|hift eac|
|00001260| 68 20 6d 6f 76 69 65 20 | 66 72 61 6d 65 20 2a 2f |h movie |frame */|
|00001270| 0d 0d 2f 2a 20 54 68 69 | 73 20 69 73 20 6a 75 73 |../* Thi|s is jus|
|00001280| 74 20 66 6f 72 20 72 65 | 66 65 72 65 6e 63 65 2e |t for re|ference.|
|00001290| 20 54 68 65 20 6f 72 69 | 67 69 6e 61 6c 20 69 73 | The ori|ginal is|
|000012a0| 20 69 6e 20 56 69 64 65 | 6f 54 6f 6f 6c 62 6f 78 | in Vide|oToolbox|
|000012b0| 2e 68 0d 73 74 72 75 63 | 74 20 56 42 4c 54 61 73 |.h.struc|t VBLTas|
|000012c0| 6b 41 6e 64 41 35 20 7b | 0d 20 20 20 20 76 6f 6c |kAndA5 {|. vol|
|000012d0| 61 74 69 6c 65 20 56 42 | 4c 54 61 73 6b 20 76 62 |atile VB|LTask vb|
|000012e0| 6c 3b 0d 20 20 20 20 6c | 6f 6e 67 20 6f 75 72 41 |l;. l|ong ourA|
|000012f0| 35 3b 0d 20 20 20 20 76 | 6f 69 64 20 28 2a 73 75 |5;. v|oid (*su|
|00001300| 62 72 6f 75 74 69 6e 65 | 29 28 73 74 72 75 63 74 |broutine|)(struct|
|00001310| 20 56 42 4c 54 61 73 6b | 41 6e 64 41 35 20 2a 76 | VBLTask|AndA5 *v|
|00001320| 62 6c 44 61 74 61 29 3b | 0d 20 20 20 20 47 44 48 |blData);|. GDH|
|00001330| 61 6e 64 6c 65 20 64 65 | 76 69 63 65 3b 0d 20 20 |andle de|vice;. |
|00001340| 20 20 6c 6f 6e 67 20 73 | 6c 6f 74 3b 0d 20 20 20 | long s|lot;. |
|00001350| 20 76 6f 6c 61 74 69 6c | 65 20 6c 6f 6e 67 20 6e | volatil|e long n|
|00001360| 65 77 46 72 61 6d 65 3b | 09 09 09 09 2f 2f 20 42 |ewFrame;|....// B|
|00001370| 6f 6f 6c 65 61 6e 0d 20 | 20 20 20 76 6f 6c 61 74 |oolean. | volat|
|00001380| 69 6c 65 20 6c 6f 6e 67 | 20 66 72 61 6d 65 73 4c |ile long| framesL|
|00001390| 65 66 74 3b 09 09 09 2f | 2f 20 63 6f 75 6e 74 20 |eft;.../|/ count |
|000013a0| 64 6f 77 6e 20 74 6f 20 | 7a 65 72 6f 0d 20 20 20 |down to |zero. |
|000013b0| 20 6c 6f 6e 67 20 66 72 | 61 6d 65 73 44 65 73 69 | long fr|amesDesi|
|000013c0| 72 65 64 3b 0d 20 20 20 | 20 76 6f 69 64 20 2a 70 |red;. | void *p|
|000013d0| 74 72 3b 09 09 09 09 09 | 09 09 2f 2f 20 75 73 65 |tr;.....|..// use|
|000013e0| 20 74 68 69 73 20 66 6f | 72 20 77 68 61 74 65 76 | this fo|r whatev|
|000013f0| 65 72 20 79 6f 75 20 77 | 61 6e 74 0d 7d 3b 0d 74 |er you w|ant.};.t|
|00001400| 79 70 65 64 65 66 20 73 | 74 72 75 63 74 20 56 42 |ypedef s|truct VB|
|00001410| 4c 54 61 73 6b 41 6e 64 | 41 35 20 56 42 4c 54 61 |LTaskAnd|A5 VBLTa|
|00001420| 73 6b 41 6e 64 41 35 3b | 0d 2a 2f 0d 0d 76 6f 69 |skAndA5;|.*/..voi|
|00001430| 64 20 6d 61 69 6e 28 76 | 6f 69 64 29 3b 0d 76 6f |d main(v|oid);.vo|
|00001440| 69 64 20 4e 6f 69 73 65 | 56 42 4c 28 76 6f 69 64 |id Noise|VBL(void|
|00001450| 29 3b 0d 0d 76 6f 69 64 | 20 6d 61 69 6e 28 29 0d |);..void| main().|
|00001460| 7b 0d 09 6c 6f 6e 67 20 | 76 65 72 73 69 6f 6e 3b |{..long |version;|
|00001470| 0d 0d 09 53 74 61 63 6b | 47 72 6f 77 28 32 30 30 |...Stack|Grow(200|
|00001480| 30 30 29 3b 0d 09 52 65 | 71 75 69 72 65 28 67 65 |00);..Re|quire(ge|
|00001490| 73 74 61 6c 74 38 42 69 | 74 51 44 29 3b 0d 09 47 |stalt8Bi|tQD);..G|
|000014a0| 65 73 74 61 6c 74 28 67 | 65 73 74 61 6c 74 53 79 |estalt(g|estaltSy|
|000014b0| 73 74 65 6d 56 65 72 73 | 69 6f 6e 2c 26 76 65 72 |stemVers|ion,&ver|
|000014c0| 73 69 6f 6e 29 3b 0d 09 | 23 69 66 20 21 64 65 66 |sion);..|#if !def|
|000014d0| 69 6e 65 64 28 5f 4d 69 | 63 72 6f 73 65 63 6f 6e |ined(_Mi|crosecon|
|000014e0| 64 73 29 0d 09 09 23 64 | 65 66 69 6e 65 20 5f 4d |ds)...#d|efine _M|
|000014f0| 69 63 72 6f 73 65 63 6f | 6e 64 73 20 30 78 61 31 |icroseco|nds 0xa1|
|00001500| 39 33 20 2f 2f 20 66 72 | 6f 6d 20 74 72 61 70 73 |93 // fr|om traps|
|00001510| 2e 68 0d 09 23 65 6e 64 | 69 66 0d 09 69 66 28 21 |.h..#end|if..if(!|
|00001520| 54 72 61 70 41 76 61 69 | 6c 61 62 6c 65 28 5f 4d |TrapAvai|lable(_M|
|00001530| 69 63 72 6f 73 65 63 6f | 6e 64 73 29 29 0d 09 09 |icroseco|nds))...|
|00001540| 50 72 69 6e 74 66 45 78 | 69 74 28 22 53 6f 72 72 |PrintfEx|it("Sorr|
|00001550| 79 2c 20 49 20 72 65 71 | 75 69 72 65 20 74 68 65 |y, I req|uire the|
|00001560| 20 4d 69 63 72 6f 73 65 | 63 6f 6e 64 73 20 74 72 | Microse|conds tr|
|00001570| 61 70 2c 20 77 68 69 63 | 68 20 69 73 20 70 61 72 |ap, whic|h is par|
|00001580| 74 20 6f 66 20 51 75 69 | 63 6b 54 69 6d 65 20 61 |t of Qui|ckTime a|
|00001590| 6e 64 20 53 79 73 74 65 | 6d 20 37 2e 5c 6e 22 29 |nd Syste|m 7.\n")|
|000015a0| 3b 0d 09 4e 6f 69 73 65 | 56 42 4c 28 29 3b 0d 7d |;..Noise|VBL();.}|
|000015b0| 0d 0d 76 6f 69 64 20 4e | 6f 69 73 65 56 42 4c 28 |..void N|oiseVBL(|
|000015c0| 29 0d 7b 0d 09 69 6e 74 | 20 69 2c 65 72 72 6f 72 |).{..int| i,error|
|000015d0| 2c 64 78 3d 33 32 2c 64 | 79 3d 33 32 2c 64 74 3d |,dx=32,d|y=32,dt=|
|000015e0| 31 3b 0d 09 6c 6f 6e 67 | 20 66 72 61 6d 65 73 3b |1;..long| frames;|
|000015f0| 0d 09 75 6e 73 69 67 6e | 65 64 20 6c 6f 6e 67 20 |..unsign|ed long |
|00001600| 73 65 65 64 3b 0d 09 64 | 6f 75 62 6c 65 20 73 3b |seed;..d|ouble s;|
|00001610| 0d 09 73 74 61 74 69 63 | 20 63 68 61 72 20 73 74 |..static| char st|
|00001620| 72 69 6e 67 5b 36 34 5d | 3b 0d 09 52 65 63 74 20 |ring[64]|;..Rect |
|00001630| 72 3b 0d 09 73 68 6f 72 | 74 20 6e 6f 69 73 65 49 |r;..shor|t noiseI|
|00001640| 3d 30 2c 6e 6f 69 73 65 | 4e 3d 4d 41 58 46 52 41 |=0,noise|N=MAXFRA|
|00001650| 4d 45 53 3b 0d 09 47 57 | 6f 72 6c 64 50 74 72 20 |MES;..GW|orldPtr |
|00001660| 6e 6f 69 73 65 49 6d 61 | 67 65 5b 4d 41 58 46 52 |noiseIma|ge[MAXFR|
|00001670| 41 4d 45 53 5d 3b 0d 09 | 73 68 6f 72 74 20 6e 6f |AMES];..|short no|
|00001680| 69 73 65 53 65 71 75 65 | 6e 63 65 5b 4d 41 58 46 |iseSeque|nce[MAXF|
|00001690| 52 41 4d 45 53 5d 3b 20 | 2f 2a 20 73 68 75 66 66 |RAMES]; |/* shuff|
|000016a0| 6c 65 64 20 73 65 71 75 | 65 6e 63 65 20 2a 2f 0d |led sequ|ence */.|
|000016b0| 09 56 42 4c 54 61 73 6b | 41 6e 64 41 35 20 6e 6f |.VBLTask|AndA5 no|
|000016c0| 69 73 65 56 42 4c 3b 0d | 09 57 69 6e 64 6f 77 50 |iseVBL;.|.WindowP|
|000016d0| 74 72 20 77 69 6e 64 6f | 77 2c 6f 6c 64 50 6f 72 |tr windo|w,oldPor|
|000016e0| 74 3b 0d 09 45 76 65 6e | 74 52 65 63 6f 72 64 20 |t;..Even|tRecord |
|000016f0| 65 76 65 6e 74 3b 0d 09 | 69 6e 74 20 73 63 72 65 |event;..|int scre|
|00001700| 65 6e 3b 0d 09 55 6e 73 | 69 67 6e 65 64 57 69 64 |en;..Uns|ignedWid|
|00001710| 65 20 6d 69 63 72 6f 54 | 69 63 6b 73 53 74 61 72 |e microT|icksStar|
|00001720| 74 2c 6d 69 63 72 6f 54 | 69 63 6b 73 3b 0d 09 42 |t,microT|icks;..B|
|00001730| 6f 6f 6c 65 61 6e 20 66 | 69 72 73 74 54 69 6d 65 |oolean f|irstTime|
|00001740| 3d 31 3b 0d 09 0d 09 61 | 73 73 65 72 74 28 53 74 |=1;....a|ssert(St|
|00001750| 61 63 6b 53 70 61 63 65 | 28 29 3e 35 30 30 30 29 |ackSpace|()>5000)|
|00001760| 3b 0d 09 47 65 74 44 61 | 74 65 54 69 6d 65 28 26 |;..GetDa|teTime(&|
|00001770| 73 65 65 64 29 3b 0d 09 | 73 72 61 6e 64 28 73 65 |seed);..|srand(se|
|00001780| 65 64 29 3b 0d 09 2f 2a | 20 49 4e 49 54 49 41 4c |ed);../*| INITIAL|
|00001790| 49 5a 45 20 51 75 69 63 | 6b 44 72 61 77 20 2a 2f |IZE Quic|kDraw */|
|000017a0| 0d 09 23 69 66 20 28 54 | 48 49 4e 4b 5f 43 20 7c |..#if (T|HINK_C ||
|000017b0| 7c 20 54 48 49 4e 4b 5f | 43 50 4c 55 53 20 7c 7c || THINK_|CPLUS |||
|000017c0| 20 53 59 4d 41 4e 54 45 | 43 5f 43 29 0d 09 09 63 | SYMANTE|C_C)...c|
|000017d0| 6f 6e 73 6f 6c 65 5f 6f | 70 74 69 6f 6e 73 2e 6e |onsole_o|ptions.n|
|000017e0| 72 6f 77 73 20 3d 20 33 | 3b 0d 09 09 70 72 69 6e |rows = 3|;...prin|
|000017f0| 74 66 28 22 5c 6e 22 29 | 3b 0d 09 23 65 6c 69 66 |tf("\n")|;..#elif|
|00001800| 20 5f 5f 4d 57 45 52 4b | 53 5f 5f 0d 09 09 53 49 | __MWERK|S__...SI|
|00001810| 4f 55 58 53 65 74 74 69 | 6e 67 73 2e 74 6f 70 70 |OUXSetti|ngs.topp|
|00001820| 69 78 65 6c 3d 4c 4d 47 | 65 74 4d 42 61 72 48 65 |ixel=LMG|etMBarHe|
|00001830| 69 67 68 74 28 29 2b 31 | 39 3b 09 2f 2f 20 61 6c |ight()+1|9;.// al|
|00001840| 6c 6f 77 20 66 6f 72 20 | 6d 65 6e 75 20 62 61 72 |low for |menu bar|
|00001850| 20 61 6e 64 20 74 69 74 | 6c 65 20 62 61 72 0d 09 | and tit|le bar..|
|00001860| 09 53 49 4f 55 58 53 65 | 74 74 69 6e 67 73 2e 6c |.SIOUXSe|ttings.l|
|00001870| 65 66 74 70 69 78 65 6c | 3d 31 3b 0d 09 09 53 49 |eftpixel|=1;...SI|
|00001880| 4f 55 58 53 65 74 74 69 | 6e 67 73 2e 72 6f 77 73 |OUXSetti|ngs.rows|
|00001890| 3d 33 3b 0d 09 09 53 49 | 4f 55 58 53 65 74 74 69 |=3;...SI|OUXSetti|
|000018a0| 6e 67 73 2e 61 75 74 6f | 63 6c 6f 73 65 6f 6e 71 |ngs.auto|closeonq|
|000018b0| 75 69 74 3d 30 3b 0d 09 | 09 53 49 4f 55 58 53 65 |uit=0;..|.SIOUXSe|
|000018c0| 74 74 69 6e 67 73 2e 73 | 68 6f 77 73 74 61 74 75 |ttings.s|howstatu|
|000018d0| 73 6c 69 6e 65 3d 30 3b | 0d 09 09 53 49 4f 55 58 |sline=0;|...SIOUX|
|000018e0| 53 65 74 74 69 6e 67 73 | 2e 61 73 6b 74 6f 73 61 |Settings|.asktosa|
|000018f0| 76 65 6f 6e 63 6c 6f 73 | 65 3d 30 3b 0d 09 09 70 |veonclos|e=0;...p|
|00001900| 72 69 6e 74 66 28 22 5c | 6e 22 29 3b 0d 09 23 65 |rintf("\|n");..#e|
|00001910| 6c 73 65 0d 09 09 49 6e | 69 74 47 72 61 66 28 26 |lse...In|itGraf(&|
|00001920| 71 64 2e 74 68 65 50 6f | 72 74 29 3b 0d 09 09 49 |qd.thePo|rt);...I|
|00001930| 6e 69 74 46 6f 6e 74 73 | 28 29 3b 0d 09 09 49 6e |nitFonts|();...In|
|00001940| 69 74 57 69 6e 64 6f 77 | 73 28 29 3b 0d 09 09 49 |itWindow|s();...I|
|00001950| 6e 69 74 43 75 72 73 6f | 72 28 29 3b 0d 09 23 65 |nitCurso|r();..#e|
|00001960| 6e 64 69 66 0d 0d 09 64 | 6f 7b 0d 09 09 69 66 28 |ndif...d|o{...if(|
|00001970| 47 65 74 53 63 72 65 65 | 6e 44 65 76 69 63 65 28 |GetScree|nDevice(|
|00001980| 31 29 21 3d 4e 55 4c 4c | 29 73 63 72 65 65 6e 3d |1)!=NULL|)screen=|
|00001990| 43 68 6f 6f 73 65 53 63 | 72 65 65 6e 28 31 2c 22 |ChooseSc|reen(1,"|
|000019a0| 57 68 69 63 68 20 73 63 | 72 65 65 6e 3f 22 29 3b |Which sc|reen?");|
|000019b0| 0d 09 09 65 6c 73 65 20 | 73 63 72 65 65 6e 3d 30 |...else |screen=0|
|000019c0| 3b 0d 09 09 6e 6f 69 73 | 65 56 42 4c 2e 64 65 76 |;...nois|eVBL.dev|
|000019d0| 69 63 65 3d 47 65 74 53 | 63 72 65 65 6e 44 65 76 |ice=GetS|creenDev|
|000019e0| 69 63 65 28 73 63 72 65 | 65 6e 29 3b 0d 09 7d 77 |ice(scre|en);..}w|
|000019f0| 68 69 6c 65 28 6e 6f 69 | 73 65 56 42 4c 2e 64 65 |hile(noi|seVBL.de|
|00001a00| 76 69 63 65 3d 3d 4e 55 | 4c 4c 29 3b 0d 0d 09 70 |vice==NU|LL);...p|
|00001a10| 72 69 6e 74 66 28 22 45 | 6e 74 65 72 20 77 69 64 |rintf("E|nter wid|
|00001a20| 74 68 20 6f 66 20 63 68 | 65 63 6b 20 69 6e 20 70 |th of ch|eck in p|
|00001a30| 69 78 65 6c 73 20 28 25 | 64 29 3f 22 2c 64 78 29 |ixels (%|d)?",dx)|
|00001a40| 3b 0d 09 67 65 74 73 28 | 73 74 72 69 6e 67 29 3b |;..gets(|string);|
|00001a50| 0d 09 73 73 63 61 6e 66 | 28 73 74 72 69 6e 67 2c |..sscanf|(string,|
|00001a60| 22 25 64 22 2c 26 64 78 | 29 3b 0d 09 70 72 69 6e |"%d",&dx|);..prin|
|00001a70| 74 66 28 22 45 6e 74 65 | 72 20 68 65 69 67 68 74 |tf("Ente|r height|
|00001a80| 20 6f 66 20 63 68 65 63 | 6b 20 69 6e 20 70 69 78 | of chec|k in pix|
|00001a90| 65 6c 73 20 28 25 64 29 | 3f 22 2c 64 79 29 3b 0d |els (%d)|?",dy);.|
|00001aa0| 09 67 65 74 73 28 73 74 | 72 69 6e 67 29 3b 0d 09 |.gets(st|ring);..|
|00001ab0| 73 73 63 61 6e 66 28 73 | 74 72 69 6e 67 2c 22 25 |sscanf(s|tring,"%|
|00001ac0| 64 22 2c 26 64 79 29 3b | 0d 09 70 72 69 6e 74 66 |d",&dy);|..printf|
|00001ad0| 28 22 45 6e 74 65 72 20 | 64 75 72 61 74 69 6f 6e |("Enter |duration|
|00001ae0| 20 6f 66 20 63 68 65 63 | 6b 20 69 6e 20 66 72 61 | of chec|k in fra|
|00001af0| 6d 65 73 20 28 25 64 29 | 3f 22 2c 64 74 29 3b 0d |mes (%d)|?",dt);.|
|00001b00| 09 67 65 74 73 28 73 74 | 72 69 6e 67 29 3b 0d 09 |.gets(st|ring);..|
|00001b10| 73 73 63 61 6e 66 28 73 | 74 72 69 6e 67 2c 22 25 |sscanf(s|tring,"%|
|00001b20| 64 22 2c 26 64 74 29 3b | 0d 0d 09 47 65 74 50 6f |d",&dt);|...GetPo|
|00001b30| 72 74 28 26 6f 6c 64 50 | 6f 72 74 29 3b 0d 09 53 |rt(&oldP|ort);..S|
|00001b40| 65 74 52 65 63 74 28 26 | 72 2c 30 2c 30 2c 57 49 |etRect(&|r,0,0,WI|
|00001b50| 44 54 48 2c 57 49 44 54 | 48 29 3b 0d 09 43 65 6e |DTH,WIDT|H);..Cen|
|00001b60| 74 65 72 52 65 63 74 49 | 6e 52 65 63 74 28 26 72 |terRectI|nRect(&r|
|00001b70| 2c 26 28 2a 6e 6f 69 73 | 65 56 42 4c 2e 64 65 76 |,&(*nois|eVBL.dev|
|00001b80| 69 63 65 29 2d 3e 67 64 | 52 65 63 74 29 3b 0d 09 |ice)->gd|Rect);..|
|00001b90| 4f 66 66 73 65 74 52 65 | 63 74 28 26 72 2c 2d 28 |OffsetRe|ct(&r,-(|
|00001ba0| 72 2e 6c 65 66 74 25 33 | 32 29 2c 30 29 3b 0d 09 |r.left%3|2),0);..|
|00001bb0| 77 69 6e 64 6f 77 3d 4e | 65 77 43 57 69 6e 64 6f |window=N|ewCWindo|
|00001bc0| 77 28 4e 55 4c 4c 2c 26 | 72 2c 22 5c 70 43 6f 6d |w(NULL,&|r,"\pCom|
|00001bd0| 70 75 74 69 6e 67 20 6e | 6f 69 73 65 20 2e 2e 2e |puting n|oise ...|
|00001be0| 22 2c 31 2c 6e 6f 47 72 | 6f 77 44 6f 63 50 72 6f |",1,noGr|owDocPro|
|00001bf0| 63 2c 28 57 69 6e 64 6f | 77 50 74 72 29 20 2d 31 |c,(Windo|wPtr) -1|
|00001c00| 4c 2c 30 2c 30 4c 29 3b | 0d 09 53 65 74 50 6f 72 |L,0,0L);|..SetPor|
|00001c10| 74 28 77 69 6e 64 6f 77 | 29 3b 0d 09 66 6f 72 28 |t(window|);..for(|
|00001c20| 69 3d 30 3b 69 3c 4d 41 | 58 46 52 41 4d 45 53 3b |i=0;i<MA|XFRAMES;|
|00001c30| 69 2b 2b 29 7b 0d 09 09 | 2f 2a 20 73 75 70 70 6c |i++){...|/* suppl|
|00001c40| 79 20 72 65 63 74 20 69 | 6e 20 67 6c 6f 62 61 6c |y rect i|n global|
|00001c50| 20 63 6f 6f 72 64 69 6e | 61 74 65 73 2e 20 54 68 | coordin|ates. Th|
|00001c60| 65 20 47 57 6f 72 6c 64 | 27 73 20 70 69 78 65 6c |e GWorld|'s pixel|
|00001c70| 73 20 77 69 6c 6c 20 62 | 65 20 61 6c 69 67 6e 65 |s will b|e aligne|
|00001c80| 64 20 77 69 74 68 20 73 | 63 72 65 65 6e 20 2a 2f |d with s|creen */|
|00001c90| 0d 09 09 65 72 72 6f 72 | 3d 4e 65 77 47 57 6f 72 |...error|=NewGWor|
|00001ca0| 6c 64 28 26 6e 6f 69 73 | 65 49 6d 61 67 65 5b 69 |ld(&nois|eImage[i|
|00001cb0| 5d 2c 30 2c 26 72 2c 4e | 55 4c 4c 2c 4e 55 4c 4c |],0,&r,N|ULL,NULL|
|00001cc0| 2c 6b 65 65 70 4c 6f 63 | 61 6c 2b 75 73 65 54 65 |,keepLoc|al+useTe|
|00001cd0| 6d 70 4d 65 6d 29 3b 0d | 09 09 69 66 28 65 72 72 |mpMem);.|..if(err|
|00001ce0| 6f 72 29 65 72 72 6f 72 | 3d 4e 65 77 47 57 6f 72 |or)error|=NewGWor|
|00001cf0| 6c 64 28 26 6e 6f 69 73 | 65 49 6d 61 67 65 5b 69 |ld(&nois|eImage[i|
|00001d00| 5d 2c 30 2c 26 72 2c 4e | 55 4c 4c 2c 4e 55 4c 4c |],0,&r,N|ULL,NULL|
|00001d10| 2c 6b 65 65 70 4c 6f 63 | 61 6c 29 3b 0d 09 09 69 |,keepLoc|al);...i|
|00001d20| 66 28 65 72 72 6f 72 29 | 62 72 65 61 6b 3b 0d 09 |f(error)|break;..|
|00001d30| 09 65 72 72 6f 72 3d 4e | 6f 69 73 65 46 69 6c 6c |.error=N|oiseFill|
|00001d40| 28 6e 6f 69 73 65 49 6d | 61 67 65 5b 69 5d 2c 26 |(noiseIm|age[i],&|
|00001d50| 6e 6f 69 73 65 49 6d 61 | 67 65 5b 69 5d 2d 3e 70 |noiseIma|ge[i]->p|
|00001d60| 6f 72 74 52 65 63 74 2c | 64 78 2c 64 79 2c 52 41 |ortRect,|dx,dy,RA|
|00001d70| 4e 44 4f 4d 50 48 41 53 | 45 29 3b 0d 09 09 4c 6f |NDOMPHAS|E);...Lo|
|00001d80| 63 6b 50 69 78 65 6c 73 | 28 6e 6f 69 73 65 49 6d |ckPixels|(noiseIm|
|00001d90| 61 67 65 5b 69 5d 2d 3e | 70 6f 72 74 50 69 78 4d |age[i]->|portPixM|
|00001da0| 61 70 29 3b 0d 09 09 69 | 66 28 65 72 72 6f 72 29 |ap);...i|f(error)|
|00001db0| 62 72 65 61 6b 3b 0d 09 | 7d 0d 09 6e 6f 69 73 65 |break;..|}..noise|
|00001dc0| 4e 3d 69 3b 0d 09 53 65 | 74 50 6f 72 74 28 6f 6c |N=i;..Se|tPort(ol|
|00001dd0| 64 50 6f 72 74 29 3b 0d | 09 70 72 69 6e 74 66 28 |dPort);.|.printf(|
|00001de0| 22 55 73 69 6e 67 20 25 | 64 20 64 69 66 66 65 72 |"Using %|d differ|
|00001df0| 65 6e 74 20 66 72 61 6d | 65 73 20 6f 66 20 6e 6f |ent fram|es of no|
|00001e00| 69 73 65 2e 5c 6e 22 2c | 28 69 6e 74 29 6e 6f 69 |ise.\n",|(int)noi|
|00001e10| 73 65 4e 29 3b 0d 09 66 | 6f 72 28 69 3d 30 3b 69 |seN);..f|or(i=0;i|
|00001e20| 3c 6e 6f 69 73 65 4e 3b | 69 2b 2b 29 6e 6f 69 73 |<noiseN;|i++)nois|
|00001e30| 65 53 65 71 75 65 6e 63 | 65 5b 69 5d 3d 69 3b 20 |eSequenc|e[i]=i; |
|00001e40| 2f 2a 20 69 6e 69 74 69 | 61 6c 69 7a 65 20 73 65 |/* initi|alize se|
|00001e50| 71 75 65 6e 63 65 20 2a | 2f 0d 09 46 6c 75 73 68 |quence *|/..Flush|
|00001e60| 45 76 65 6e 74 73 28 2d | 31 4c 2c 30 29 3b 0d 09 |Events(-|1L,0);..|
|00001e70| 70 72 69 6e 74 66 28 22 | 48 69 74 20 61 6e 79 20 |printf("|Hit any |
|00001e80| 6b 65 79 20 74 6f 20 71 | 75 69 74 2e 5c 6e 22 29 |key to q|uit.\n")|
|00001e90| 3b 0d 09 46 6c 75 73 68 | 45 76 65 6e 74 73 28 65 |;..Flush|Events(e|
|00001ea0| 76 65 72 79 45 76 65 6e | 74 2c 30 29 3b 0d 09 53 |veryEven|t,0);..S|
|00001eb0| 65 74 57 54 69 74 6c 65 | 28 77 69 6e 64 6f 77 2c |etWTitle|(window,|
|00001ec0| 22 5c 70 4e 6f 69 73 65 | 56 42 4c 22 29 3b 0d 09 |"\pNoise|VBL");..|
|00001ed0| 64 6f 7b 0d 09 09 53 65 | 6c 65 63 74 57 69 6e 64 |do{...Se|lectWind|
|00001ee0| 6f 77 28 77 69 6e 64 6f | 77 29 3b 0d 09 09 53 68 |ow(windo|w);...Sh|
|00001ef0| 75 66 66 6c 65 28 6e 6f | 69 73 65 53 65 71 75 65 |uffle(no|iseSeque|
|00001f00| 6e 63 65 2c 6e 6f 69 73 | 65 4e 2c 73 69 7a 65 6f |nce,nois|eN,sizeo|
|00001f10| 66 28 2a 6e 6f 69 73 65 | 53 65 71 75 65 6e 63 65 |f(*noise|Sequence|
|00001f20| 29 29 3b 09 2f 2a 20 73 | 68 75 66 66 6c 65 20 74 |));./* s|huffle t|
|00001f30| 68 65 20 69 6d 61 67 65 | 73 20 2a 2f 0d 09 09 6e |he image|s */...n|
|00001f40| 6f 69 73 65 49 3d 30 3b | 0d 09 09 6e 6f 69 73 65 |oiseI=0;|...noise|
|00001f50| 56 42 4c 2e 73 75 62 72 | 6f 75 74 69 6e 65 3d 4e |VBL.subr|outine=N|
|00001f60| 55 4c 4c 3b 09 2f 2f 20 | 75 73 65 20 64 65 66 61 |ULL;.// |use defa|
|00001f70| 75 6c 74 0d 09 09 65 72 | 72 6f 72 3d 56 42 4c 49 |ult...er|ror=VBLI|
|00001f80| 6e 73 74 61 6c 6c 28 26 | 6e 6f 69 73 65 56 42 4c |nstall(&|noiseVBL|
|00001f90| 2c 6e 6f 69 73 65 56 42 | 4c 2e 64 65 76 69 63 65 |,noiseVB|L.device|
|00001fa0| 2c 4d 41 58 46 52 41 4d | 45 53 29 3b 0d 09 09 69 |,MAXFRAM|ES);...i|
|00001fb0| 66 28 65 72 72 6f 72 29 | 50 72 69 6e 74 66 45 78 |f(error)|PrintfEx|
|00001fc0| 69 74 28 22 56 42 4c 49 | 6e 73 74 61 6c 6c 3a 20 |it("VBLI|nstall: |
|00001fd0| 65 72 72 6f 72 20 25 64 | 5c 6e 22 2c 65 72 72 6f |error %d|\n",erro|
|00001fe0| 72 29 3b 0d 09 09 6e 6f | 69 73 65 56 42 4c 2e 76 |r);...no|iseVBL.v|
|00001ff0| 62 6c 2e 76 62 6c 43 6f | 75 6e 74 3d 31 3b 09 2f |bl.vblCo|unt=1;./|
|00002000| 2f 20 45 6e 61 62 6c 65 | 20 69 6e 74 65 72 72 75 |/ Enable| interru|
|00002010| 70 74 20 73 65 72 76 69 | 63 65 20 72 6f 75 74 69 |pt servi|ce routi|
|00002020| 6e 65 0d 09 09 77 68 69 | 6c 65 28 21 6e 6f 69 73 |ne...whi|le(!nois|
|00002030| 65 56 42 4c 2e 6e 65 77 | 46 72 61 6d 65 29 20 3b |eVBL.new|Frame) ;|
|00002040| 09 2f 2f 20 77 61 69 74 | 20 66 6f 72 20 66 69 72 |.// wait| for fir|
|00002050| 73 74 20 66 72 61 6d 65 | 0d 09 09 6e 6f 69 73 65 |st frame|...noise|
|00002060| 56 42 4c 2e 6e 65 77 46 | 72 61 6d 65 3d 30 3b 0d |VBL.newF|rame=0;.|
|00002070| 09 09 77 68 69 6c 65 28 | 21 6e 6f 69 73 65 56 42 |..while(|!noiseVB|
|00002080| 4c 2e 6e 65 77 46 72 61 | 6d 65 29 20 3b 09 2f 2f |L.newFra|me) ;.//|
|00002090| 20 77 61 69 74 20 66 6f | 72 20 73 65 63 6f 6e 64 | wait fo|r second|
|000020a0| 20 66 72 61 6d 65 0d 09 | 09 4d 69 63 72 6f 73 65 | frame..|.Microse|
|000020b0| 63 6f 6e 64 73 28 26 6d | 69 63 72 6f 54 69 63 6b |conds(&m|icroTick|
|000020c0| 73 53 74 61 72 74 29 3b | 0d 09 09 66 72 61 6d 65 |sStart);|...frame|
|000020d0| 73 3d 6e 6f 69 73 65 56 | 42 4c 2e 66 72 61 6d 65 |s=noiseV|BL.frame|
|000020e0| 73 4c 65 66 74 3b 0d 09 | 09 77 68 69 6c 65 28 6e |sLeft;..|.while(n|
|000020f0| 6f 69 73 65 56 42 4c 2e | 66 72 61 6d 65 73 4c 65 |oiseVBL.|framesLe|
|00002100| 66 74 3e 31 29 7b 0d 09 | 09 09 69 66 28 6e 6f 69 |ft>1){..|..if(noi|
|00002110| 73 65 56 42 4c 2e 6e 65 | 77 46 72 61 6d 65 29 7b |seVBL.ne|wFrame){|
|00002120| 0d 09 09 09 09 6e 6f 69 | 73 65 56 42 4c 2e 6e 65 |.....noi|seVBL.ne|
|00002130| 77 46 72 61 6d 65 3d 30 | 3b 0d 09 09 09 09 43 6f |wFrame=0|;.....Co|
|00002140| 70 79 57 69 6e 64 6f 77 | 73 28 6e 6f 69 73 65 49 |pyWindow|s(noiseI|
|00002150| 6d 61 67 65 5b 6e 6f 69 | 73 65 53 65 71 75 65 6e |mage[noi|seSequen|
|00002160| 63 65 5b 6e 6f 69 73 65 | 49 5d 5d 2c 28 43 57 69 |ce[noise|I]],(CWi|
|00002170| 6e 64 6f 77 50 74 72 29 | 77 69 6e 64 6f 77 0d 09 |ndowPtr)|window..|
|00002180| 09 09 09 09 2c 26 6e 6f | 69 73 65 49 6d 61 67 65 |....,&no|iseImage|
|00002190| 5b 30 5d 2d 3e 70 6f 72 | 74 52 65 63 74 2c 26 77 |[0]->por|tRect,&w|
|000021a0| 69 6e 64 6f 77 2d 3e 70 | 6f 72 74 52 65 63 74 2c |indow->p|ortRect,|
|000021b0| 73 72 63 43 6f 70 79 2c | 4e 55 4c 4c 29 3b 0d 09 |srcCopy,|NULL);..|
|000021c0| 09 09 09 69 66 28 6e 6f | 69 73 65 56 42 4c 2e 66 |...if(no|iseVBL.f|
|000021d0| 72 61 6d 65 73 4c 65 66 | 74 25 64 74 3d 3d 30 29 |ramesLef|t%dt==0)|
|000021e0| 7b 0d 09 09 09 09 09 6e | 6f 69 73 65 49 2b 2b 3b |{......n|oiseI++;|
|000021f0| 0d 09 09 09 09 09 69 66 | 28 6e 6f 69 73 65 49 3e |......if|(noiseI>|
|00002200| 3d 6e 6f 69 73 65 4e 29 | 20 7b 0d 09 09 09 09 09 |=noiseN)| {......|
|00002210| 09 53 68 75 66 66 6c 65 | 28 6e 6f 69 73 65 53 65 |.Shuffle|(noiseSe|
|00002220| 71 75 65 6e 63 65 2c 6e | 6f 69 73 65 4e 2c 73 69 |quence,n|oiseN,si|
|00002230| 7a 65 6f 66 28 2a 6e 6f | 69 73 65 53 65 71 75 65 |zeof(*no|iseSeque|
|00002240| 6e 63 65 29 29 3b 0d 09 | 09 09 09 09 09 6e 6f 69 |nce));..|.....noi|
|00002250| 73 65 49 3d 30 3b 0d 09 | 09 09 09 09 7d 0d 09 09 |seI=0;..|....}...|
|00002260| 09 09 7d 0d 09 09 09 7d | 0d 09 09 7d 0d 09 09 77 |..}....}|...}...w|
|00002270| 68 69 6c 65 28 21 6e 6f | 69 73 65 56 42 4c 2e 6e |hile(!no|iseVBL.n|
|00002280| 65 77 46 72 61 6d 65 29 | 20 3b 09 2f 2f 20 77 61 |ewFrame)| ;.// wa|
|00002290| 69 74 20 66 6f 72 20 6c | 61 73 74 20 66 72 61 6d |it for l|ast fram|
|000022a0| 65 0d 09 09 66 72 61 6d | 65 73 2d 3d 6e 6f 69 73 |e...fram|es-=nois|
|000022b0| 65 56 42 4c 2e 66 72 61 | 6d 65 73 4c 65 66 74 3b |eVBL.fra|mesLeft;|
|000022c0| 0d 09 09 4d 69 63 72 6f | 73 65 63 6f 6e 64 73 28 |...Micro|seconds(|
|000022d0| 26 6d 69 63 72 6f 54 69 | 63 6b 73 29 3b 0d 09 09 |&microTi|cks);...|
|000022e0| 73 3d 28 6d 69 63 72 6f | 54 69 63 6b 73 2e 6c 6f |s=(micro|Ticks.lo|
|000022f0| 2d 6d 69 63 72 6f 54 69 | 63 6b 73 53 74 61 72 74 |-microTi|cksStart|
|00002300| 2e 6c 6f 29 0d 09 09 09 | 2b 28 64 6f 75 62 6c 65 |.lo)....|+(double|
|00002310| 29 30 78 31 30 30 30 30 | 2a 30 78 31 30 30 30 30 |)0x10000|*0x10000|
|00002320| 2a 28 6d 69 63 72 6f 54 | 69 63 6b 73 2e 68 69 2d |*(microT|icks.hi-|
|00002330| 6d 69 63 72 6f 54 69 63 | 6b 73 53 74 61 72 74 2e |microTic|ksStart.|
|00002340| 68 69 29 3b 0d 09 09 73 | 2f 3d 31 65 36 3b 0d 09 |hi);...s|/=1e6;..|
|00002350| 09 56 42 4c 52 65 6d 6f | 76 65 28 26 6e 6f 69 73 |.VBLRemo|ve(&nois|
|00002360| 65 56 42 4c 29 3b 0d 09 | 09 2f 2a 0d 09 09 54 68 |eVBL);..|./*...Th|
|00002370| 65 20 75 73 65 20 6f 66 | 20 5c 6e 20 6f 6e 20 74 |e use of| \n on t|
|00002380| 68 65 20 66 69 72 73 74 | 20 74 69 6d 65 20 69 73 |he first| time is|
|00002390| 20 61 20 77 6f 72 6b 20 | 61 72 6f 75 6e 64 20 66 | a work |around f|
|000023a0| 6f 72 20 61 20 62 75 67 | 20 69 6e 20 74 68 65 20 |or a bug| in the |
|000023b0| 43 6f 64 65 57 61 72 72 | 69 6f 72 20 36 2e 31 0d |CodeWarr|ior 6.1.|
|000023c0| 09 09 53 49 4f 55 58 20 | 63 6f 6e 73 6f 6c 65 2e |..SIOUX |console.|
|000023d0| 20 49 74 20 66 61 69 6c | 73 20 74 6f 20 75 70 64 | It fail|s to upd|
|000023e0| 61 74 65 20 74 68 65 20 | 73 63 72 65 65 6e 20 77 |ate the |screen w|
|000023f0| 68 65 6e 20 79 6f 75 20 | 73 65 6e 64 20 61 20 5c |hen you |send a \|
|00002400| 72 2c 20 61 6e 64 20 6f | 6e 6c 79 20 64 6f 65 73 |r, and o|nly does|
|00002410| 20 73 6f 0d 09 09 77 68 | 65 6e 20 69 74 20 72 65 | so...wh|en it re|
|00002420| 63 65 69 76 65 73 20 61 | 20 5c 6e 2e 20 43 61 6c |ceives a| \n. Cal|
|00002430| 6c 69 6e 67 20 66 66 6c | 75 73 68 28 73 74 64 6f |ling ffl|ush(stdo|
|00002440| 75 74 29 20 77 6f 75 6c | 64 20 66 6f 72 63 65 20 |ut) woul|d force |
|00002450| 74 68 65 20 73 63 72 65 | 65 6e 20 74 6f 20 75 70 |the scre|en to up|
|00002460| 64 61 74 65 2c 20 62 75 | 74 0d 09 09 2d 2d 61 6e |date, bu|t...--an|
|00002470| 6f 74 68 65 72 20 62 75 | 67 2d 2d 61 6c 73 6f 20 |other bu|g--also |
|00002480| 66 6c 75 73 68 65 73 20 | 73 74 64 69 6e 2c 20 64 |flushes |stdin, d|
|00002490| 69 73 63 61 72 64 69 6e | 67 20 74 68 65 20 75 73 |iscardin|g the us|
|000024a0| 65 72 27 73 20 6b 65 79 | 73 74 72 6f 6b 65 73 2c |er's key|strokes,|
|000024b0| 20 77 68 69 63 68 20 6d | 61 6b 65 73 20 69 74 0d | which m|akes it.|
|000024c0| 09 09 68 61 72 64 20 66 | 6f 72 20 74 68 65 20 75 |..hard f|or the u|
|000024d0| 73 65 72 20 74 6f 20 71 | 75 69 74 20 74 68 69 73 |ser to q|uit this|
|000024e0| 20 70 72 6f 67 72 61 6d | 2e 20 53 6f 20 77 65 20 | program|. So we |
|000024f0| 75 73 65 20 5c 6e 20 6f | 6e 20 74 68 65 20 66 69 |use \n o|n the fi|
|00002500| 72 73 74 20 74 69 6d 65 | 2c 20 73 6f 20 74 68 65 |rst time|, so the|
|00002510| 20 75 73 65 72 0d 09 09 | 67 65 74 73 20 74 6f 20 | user...|gets to |
|00002520| 73 65 65 20 61 74 20 6c | 65 61 73 74 20 74 68 65 |see at l|east the|
|00002530| 20 66 69 72 73 74 20 74 | 69 6d 69 6e 67 20 72 65 | first t|iming re|
|00002540| 73 75 6c 74 2e 0d 09 09 | 2a 2f 0d 09 09 69 66 28 |sult....|*/...if(|
|00002550| 66 69 72 73 74 54 69 6d | 65 29 70 72 69 6e 74 66 |firstTim|e)printf|
|00002560| 28 22 25 2e 31 66 20 66 | 72 61 6d 65 73 2f 73 2e |("%.1f f|rames/s.|
|00002570| 5c 6e 22 2c 66 72 61 6d | 65 73 2f 73 29 3b 0d 09 |\n",fram|es/s);..|
|00002580| 09 65 6c 73 65 20 70 72 | 69 6e 74 66 28 22 25 2e |.else pr|intf("%.|
|00002590| 31 66 20 66 72 61 6d 65 | 73 2f 73 2e 20 5c 72 22 |1f frame|s/s. \r"|
|000025a0| 2c 66 72 61 6d 65 73 2f | 73 29 3b 0d 09 09 66 69 |,frames/|s);...fi|
|000025b0| 72 73 74 54 69 6d 65 3d | 30 3b 0d 09 7d 77 68 69 |rstTime=|0;..}whi|
|000025c0| 6c 65 28 21 47 65 74 4e | 65 78 74 45 76 65 6e 74 |le(!GetN|extEvent|
|000025d0| 28 6b 65 79 44 6f 77 6e | 4d 61 73 6b 2c 26 65 76 |(keyDown|Mask,&ev|
|000025e0| 65 6e 74 29 29 3b 0d 09 | 46 6c 75 73 68 45 76 65 |ent));..|FlushEve|
|000025f0| 6e 74 73 28 65 76 65 72 | 79 45 76 65 6e 74 2c 30 |nts(ever|yEvent,0|
|00002600| 29 3b 0d 09 66 6f 72 20 | 28 69 3d 30 3b 69 3c 6e |);..for |(i=0;i<n|
|00002610| 6f 69 73 65 4e 3b 69 2b | 2b 29 20 44 69 73 70 6f |oiseN;i+|+) Dispo|
|00002620| 73 65 47 57 6f 72 6c 64 | 28 6e 6f 69 73 65 49 6d |seGWorld|(noiseIm|
|00002630| 61 67 65 5b 69 5d 29 3b | 0d 09 44 69 73 70 6f 73 |age[i]);|..Dispos|
|00002640| 65 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 29 3b |eWindow(|window);|
|00002650| 0d 09 23 69 66 20 28 54 | 48 49 4e 4b 5f 43 20 7c |..#if (T|HINK_C ||
|00002660| 7c 20 54 48 49 4e 4b 5f | 43 50 4c 55 53 20 7c 7c || THINK_|CPLUS |||
|00002670| 20 53 59 4d 41 4e 54 45 | 43 5f 43 29 0d 09 09 61 | SYMANTE|C_C)...a|
|00002680| 62 6f 72 74 28 29 3b 0d | 09 23 65 6c 69 66 20 5f |bort();.|.#elif _|
|00002690| 5f 4d 57 45 52 4b 53 5f | 5f 0d 09 09 53 49 4f 55 |_MWERKS_|_...SIOU|
|000026a0| 58 53 65 74 74 69 6e 67 | 73 2e 61 75 74 6f 63 6c |XSetting|s.autocl|
|000026b0| 6f 73 65 6f 6e 71 75 69 | 74 3d 31 3b 0d 09 23 65 |oseonqui|t=1;..#e|
|000026c0| 6e 64 69 66 0d 7d 0d 00 | 00 00 00 00 00 00 00 00 |ndif.}..|........|
|000026d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000026e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000026f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002700| 00 00 01 00 00 00 02 56 | 00 00 01 56 00 00 00 9e |.......V|...V....|
|00002710| 00 00 2c 72 00 00 00 ec | 05 00 00 00 2c 76 00 00 |..,r....|....,v..|
|00002720| 00 ed 05 00 00 00 2c 7a | 00 00 00 ee 05 00 00 00 |......,z|........|
|00002730| 0a 4e 6f 69 73 65 56 42 | 4c 2e 63 65 02 00 00 00 |.NoiseVB|L.ce....|
|00002740| 54 45 58 54 43 57 49 45 | 01 00 01 54 00 00 00 00 |TEXTCWIE|...T....|
|00002750| 00 00 54 45 58 54 43 57 | 49 45 01 00 01 54 00 00 |..TEXTCW|IE...T..|
|00002760| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002770| 00 00 9e c0 9d ff 00 00 | 26 47 00 00 02 f4 00 00 |........|&G......|
|00002780| 2c 9e 00 00 00 f7 05 00 | 00 00 2c a2 00 00 00 f8 |,.......|..,.....|
|00002790| 05 00 00 00 2c a6 00 00 | 00 f9 05 00 00 00 2c aa |....,...|......,.|
|000027a0| 00 00 00 fa 05 00 00 00 | 2c ae 00 00 00 fb 05 00 |........|,.......|
|000027b0| 00 00 2c b2 00 00 00 fc | 05 00 00 00 2c b6 00 00 |..,.....|....,...|
|000027c0| 00 fd 05 00 00 00 2c ba | 00 00 08 dd 05 00 00 00 |......,.|........|
|000027d0| 2d 03 00 00 09 25 05 00 | 00 00 2d 0f 00 00 09 3e |-....%..|..-....>|
|000027e0| 05 00 00 00 2d 18 00 00 | 09 3f 05 00 00 00 2d 1c |....-...|.?....-.|
|000027f0| 00 00 09 40 05 00 00 00 | 2d 20 00 00 09 41 05 00 |...@....|- ...A..|
|00002800| 00 00 00 14 00 00 19 11 | ff ff 00 00 00 00 00 00 |........|........|
|00002810| 1d 0e 00 bf 00 00 00 00 | 00 00 00 2e 00 02 00 14 |........|........|
|00002820| 00 00 1e 4d 00 c9 00 00 | 00 00 10 02 05 6d 79 41 |...M....|.....myA|
|00002830| 35 20 00 18 00 00 19 27 | 00 a4 00 00 00 00 00 00 |5 .....'|........|
|00002840| 09 63 75 72 72 65 6e 74 | 41 35 00 00 00 32 00 00 |.current|A5...2..|
|00002850| 19 cc 00 aa 00 00 00 00 | 00 00 18 2f 00 98 00 00 |........|.../....|
|00002860| 00 00 00 00 16 ab 00 8a | 00 00 00 00 00 00 16 26 |........|.......&|
|00002870| 00 85 00 00 00 00 00 00 | 1d 64 00 c4 00 00 00 00 |........|.d......|
|00002880| 00 00 00 36 00 02 00 14 | 00 00 1a 05 00 ac 00 b1 |...6....|........|
|00002890| d6 74 00 00 05 65 72 72 | 6f 72 00 20 00 00 1a c7 |.t...err|or. ....|
|000028a0| 00 b4 00 b1 d6 64 00 00 | 11 6e 6f 69 73 65 56 42 |.....d..|.noiseVB|
|000028b0| 4c 2e 6e 65 77 46 72 61 | 6d 65 00 00 00 1e 00 3f |L.newFra|me.....?|
|000028c0| 00 53 02 6d 02 cb 00 3f | 00 53 02 6d 02 cb 00 00 |.S.m...?|.S.m....|
|000028d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 22 |........|......."|
|000028e0| 00 02 00 00 11 bc 00 00 | 11 c0 05 6d 61 69 6e 00 |........|...main.|
|000028f0| 00 00 12 22 00 00 12 2a | 09 4e 6f 69 73 65 56 42 |..."...*|.NoiseVB|
|00002900| 4c 00 00 00 00 48 00 09 | 4d 6f 6e 61 63 6f 00 00 |L....H..|Monaco..|
|00002910| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002920| 00 00 00 00 00 00 00 00 | 00 03 00 04 00 57 00 03 |........|.....W..|
|00002930| 02 77 02 61 00 57 00 03 | 02 77 02 61 ad b5 cf 30 |.w.a.W..|.w.a...0|
|00002940| 00 00 16 ae 00 00 16 c4 | 00 00 14 be 00 00 00 00 |........|........|
|00002950| 00 04 00 01 00 01 00 00 | 01 00 00 00 02 56 00 00 |........|.....V..|
|00002960| 01 56 00 00 00 9e 00 fc | bd 98 37 74 00 00 00 1c |.V......|..7t....|
|00002970| 00 9e 00 03 42 4b 50 54 | 00 01 00 22 44 54 56 55 |....BKPT|..."DTVU|
|00002980| 00 01 00 3a 4d 50 53 52 | 00 02 00 52 4d 57 42 42 |...:MPSR|...RMWBB|
|00002990| 00 00 00 76 20 b1 ff ff | 00 00 00 00 00 00 00 00 |...v ...|........|
|000029a0| 2f d2 ff ff 00 00 00 4a | 00 00 00 00 65 df ff ff |/......J|....e...|
|000029b0| 00 00 00 18 00 00 00 00 | 32 1c ff ff 00 00 00 80 |........|2.......|
|000029c0| 00 00 00 00 03 f0 ff ff | 00 00 00 ba 00 00 00 00 |........|........|
|000029d0| 03 ef ff ff 00 00 00 dc | 00 00 00 00 03 ed ff ff |........|........|
|000029e0| 00 00 01 02 00 00 00 00 | 03 f0 ff ff 00 00 01 4e |........|.......N|
|000029f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+